﻿@using System.Reflection
@using XCode
@using XCode.Configuration
@{
    Layout = NewLife.Cube.Setting.Current.Layout;

    var fact = ViewBag.Factory as IEntityOperate;
    var fields = ViewBag.Fields as List<FieldItem>;
    var entity = Model as IEntity;
    var isNew = entity.IsNullKey;

    var rv = entity.GetRouteKey();
}

<div class="form-horizontal">
    @Html.Partial("_Form_Header", entity)
    @using (Html.BeginForm((isNew ? "Add" : "Edit"), null, rv))
    {
        @Html.AntiForgeryToken()
        @Html.ValidationSummary()
        foreach (var item in fields)
        {
            @*2017-08-25 siery 修改判断主键为自增类型才隐藏。主要解决非自增主键新增时候无法显示问题。旧版本可以重载Views/Shared/Form.cshtml解决*@
    if (!item.IsIdentity)
    {
        @Html.Partial("_Form_Group", new Pair(Model, item))
        }
    }
    @*@Html.Partial("_Form_Footer", entity)*@
        @Html.Partial("_Form_Action", entity)
    }
</div>
